#include("../_common/form_input.html")
#@admin_header()
<!-- 内容主体区域 -->
<div class="layui-body">
  <div style="padding: 15px;">
    <fieldset class="layui-elem-field layui-field-title">
      <legend>已有文件夹</legend>
    </fieldset>
    <style>
      .cell-a {
        display: inline-block;
        margin: 0 0px 6px 0;
        padding: 5px 14px;
        border: 1px solid #c2c2c2;
        border-right-color: #f0f0f0;
        /*color: #666;*/
        line-height: 24px;
        font-size: 16px !important
      }

      .cell-a:nth-child(even) {
        margin-right: 5px;
        border-radius: 3px;
        color: #1E9FFF;
        border: 1px solid #01AAED;
      }

      .cell-a:hover {
        color: #1E9FFF;
      }
    </style>
    <div class="layui-row">
      <div class="layui-col-md12">
        #for(x : list)
        <span style="display:inline-block"><a class="cell-a">#(x)</a><a class="cell-a"
                                                                        href="#(adminRoot)/spider/file/merge/download/#(x)"
                                                                        target="_blank"><i
            class="layui-icon">&#xe601;</i></a></span>
        #end
      </div>
    </div>
    <fieldset class="layui-elem-field layui-field-title">
      <legend>文件合并</legend>
    </fieldset>
    <form class="layui-form layui-form-pane">
      #@form_input("fold_name", "文件夹名", "", "文件夹名", "单文件路径存放的文件夹名，从已有文件夹中选取")
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-filter="file_merge" lay-submit="">立即开始</button>
          <button class="layui-btn layui-btn-primary" type="reset">重置</button>
        </div>
      </div>
    </form>
  </div>
</div>
<script>
  //JavaScript代码区域
  layui.use(['table'], function () {
  });
  //JavaScript代码区域
  layui.use('form', function () {
    var form = layui.form;
    form.render();
    // 自定义验证
    form.verify({
      fold_name: function (value) {
        if (value == '') {
          return '请输入文件路径';
        }
      }
    });
    // 提交
    form.on('submit(file_merge)', function (data) {
      ToastLoading('正在保存...');
      $.post("#(adminRoot)/spider/file/merge/save", data.field)
        .success(function (ret) {
          ToastShow(ret.code, ret.msg, ret.url);
        })
        .error(function () {
          ToastErr('网络错误');
        })
      return false;
    });
  });
</script>
#@admin_footer()
